import request from "@/utils/request";

//情景列表
export function getTestscene(method, data) {
  if (method == "post") {
    return request({
      url: "/test/scene",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/test/scene",
      method: method,
      params: data,
    });
  }
}
//楼栋信息
export function getTestarea(method, data) {
  if (method == "post") {
    return request({
      url: "/test/area",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/test/area",
      method: method,
      params: data,
    });
  }
}
//房间设备开关
export function testRoomcontrol(method, data) {
  if (method == "post") {
    return request({
      url: "/test/roomcontrol",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/test/roomcontrol",
      method: method,
      params: data,
    });
  }
}

//单个设备开关
export function testDeviceonoff(method, data) {
  if (method == "post") {
    return request({
      url: "/test/deviceonoff",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/test/deviceonoff",
      method: method,
      params: data,
    });
  }
}

//执行情景
export function testExecute(method, data) {
  if (method == "post") {
    return request({
      url: "/test/execute",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/test/execute",
      method: method,
      params: data,
    });
  }
}

//房间设备列表
export function areadevice(method, data) {
  if (method == "post") {
    return request({
      url: "/test/areadevice",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/test/areadevice",
      method: method,
      params: data,
    });
  }
}

//温湿度状态
export function devicestatus(method, data) {
  if (method == "post") {
    return request({
      url: "/test/devicestatus",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/test/devicestatus",
      method: method,
      params: data,
    });
  }
}

//ysx start

//网关登录
/**
 * 二楼网关id：40aa568e24d5
 * @param {host_id} params
 * @returns {}
 */
export function ysxShowLogin(params) {
  return request({
    url: "/show/login",
    method: 'get',
    params
  });
}


/**
 *
 * @param {host_id} params
 * @returns {}
 */
//获取网关内的区域
export function ysxShowArea(params) {
  return request({
    url: "/show/area",
    method: 'get',
    params
  });
}

/**
 *
 * @param {host_id} params
 * @returns {}
 */
//获取区域内的设备
export function ysxShowAreadevice(params) {
  return request({
    url: "/show/areadevice",
    method: 'get',
    params
  });
}

/**
 *
 * @param {host_id} params
 * @returns {}
 */
//获取情景列表
export function ysxShowScene(params) {
  return request({
    url: "/show/scene",
    method: 'get',
    params
  });
}

/**
 *
 * @param {host_id} params
 * @param {scene_id} params
 * @returns {}
 */
//执行情景
export function ysxShowSceneexecute(params) {
  return request({
    url: "/show/sceneexecute",
    method: 'get',
    params
  });
}

/**
 *
 * @param {host_id} params
 * @returns {}
 */
//获取所有设备
export function ysxShowAlldevice(params) {
  return request({
    url: "/show/alldevice",
    method: 'get',
    params
  });
}


/**
 *
 * @param {host_id} params
 * @param {ids: code1,code2} params
 * @returns {}
 */
//设备状态查询
export function ysxShowDevicestatus(params) {
  return request({
    url: "/show/devicestatus",
    method: 'get',
    params
  });
}

/**
 * type  1、灯光  2、SOS  3、门禁  4、可燃气体 5、人体红外传感 6、烟雾 7、窗帘 8、漏水报警  9、温湿度 10、安防
 * @param {host_id} params
 * @param {onoff: on | off} params
 * @param {devcie_code} params
 * @param {type} params
 * @returns {}
 */
//单个设备开关
export function ysxShowDeviceonoff(params) {
  return request({
    url: "/show/deviceonoff",
    method: 'get',
    params
  });
}

/**
 *
 * @param {host_id} params
 * @param {parent_id} params
 * @param {area_id} params
 * @returns {}
 */
//单个房间控制开关
export function ysxShowRoomcontrol(params) {
  return request({
    url: "/show/roomcontrol",
    method: 'get',
    params
  });
}

/**
 *
 * @param {host_id} params
 * @param {area_name: 居家自理室} params
 * @returns {}
 */
//获取房间设备列表
export function ysxShowDevicesfromareaname(params) {
  return request({
    url: "/show/devicesfromareaname",
    method: 'get',
    params
  });
}


/**
 * 房间及设备列表
 * @returns {}
 */
//获取房间设备列表
export function ysxBoxinfo() {
  return request({
    url: "/box/info",
    method: 'get',
  });
}


/**
 * @param {device_id} params
 * @param {onoff} params
 */
//单个房间设备控制开关
export function ysxBoxonff(params) {
  return request({
    url: "/box/onoff",
    method: 'get',
    params
  });
}


/**
 * @param {room_id} params
 * @param {onoff} params
 */
//单个房间全部设备控制开关
export function ysxBoxAllonoff(params) {
  return request({
    url: "/box/allonoff",
    method: 'get',
    params
  });
}
